package com.sky.dao.impl;

import com.sky.dao.UserDao;
import com.sky.domain.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
import java.util.Map;
import java.util.Properties;

//<bean id="userDao" class="com.sky.dao.impl.UserDaoImpl"/>
//@Component("userDao")
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    @Value("#{'1,2,3'.split(',')}")
    private List<String> strList;
    private Map<String, User> userMap;
    private Properties properties;

    public UserDaoImpl() {
        System.out.println("UserDao已经被创建....");
    }

    public List<String> getStrList() {
        return strList;
    }

    public void setStrList(List<String> strList) {
        this.strList = strList;
    }

    public Map<String, User> getUserMap() {
        return userMap;
    }

    public void setUserMap(Map<String, User> userMap) {
        this.userMap = userMap;
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    @PostConstruct
    public void init() {
        System.out.println("初始化方法....");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("销毁方法.....");
    }

    @Override
    public void save() {
        System.out.println("Save Running...");
        System.out.println(strList);
        System.out.println(userMap);
        System.out.println(properties);
    }
}
